<!DOCTYPE html>
<html>
<!--
Copyright 2008 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
Author: attila@google.com (Attila Bodis)
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Closure Unit Tests - goog.ui.Tab</title>
  <script src="../base.js"></script>
  <script>
    goog.require('goog.dom');
    goog.require('goog.testing.jsunit');
    goog.require('goog.ui.Component.State');
    goog.require('goog.ui.Tab');
    goog.require('goog.ui.TabRenderer');
  </script>
</head>
<body>
  <div id="sandbox"></div>
  <script>
    var sandbox = goog.dom.getElement('sandbox');
    var tab;

    function setUp() {
      tab = new goog.ui.Tab('Hello');
    }
    
    function tearDown() {
      tab.dispose();
      goog.dom.removeChildren(sandbox);
    }

    function testConstructor() {
      assertNotNull('Tab must not be null', tab);
      assertEquals('Tab must have expected content', 'Hello', tab.getContent());
      assertEquals('Tab\'s renderer must default to TabRenderer',
          goog.ui.TabRenderer.getInstance(), tab.getRenderer());
      assertTrue('Tab must support the SELECTED state',
          tab.isSupportedState(goog.ui.Component.State.SELECTED));
      assertTrue('SELECTED must be an auto-state',
          tab.isAutoState(goog.ui.Component.State.SELECTED));
      assertTrue('Tab must dispatch transition events for the DISABLED state',
          tab.isDispatchTransitionEvents(goog.ui.Component.State.DISABLED));
      assertTrue('Tab must dispatch transition events for the SELECTED state',
          tab.isDispatchTransitionEvents(goog.ui.Component.State.SELECTED));
    }

    function testGetSetTooltip() {
      assertUndefined('Tooltip must be undefined by default', tab.getTooltip());
      tab.setTooltip('Hello, world!');
      assertEquals('Tooltip must have expected value', 'Hello, world!',
          tab.getTooltip());
    }
  </script>
</body>
</html>
